-- card: 44454 from stack: in -- bmap block id: 0 -- flags: 0000 -- background id: 4755 -- name: -- part contents for background part 6 ----- text ----- 5.1 Arithmetic Operators -- part contents for background part 7 ----- text ----- 142 -- part contents for background part 4 ----- text ----- As expected, the multiplication '*' and division '/' operators have precedence over the addition '+' and subtraction '-' operators. The modulus operator '%' produces the remainder when its integer operands divide each other. No exponentiation operator is provided. The standard math library function pow() serves this purpose*. One source of occasional programming errors is that arithmetic operations involving only integer values produce an integer result. In the following example, the float variable f is initialized with the value 0 whereas g is assigned 0.5 (recall that constants must contain a decimal point to be considered as floating-point numbers). float f = 1/2; /* assigns 0 to f */ float g = 1./2.; The unary (one-operand) negation operator '-' has higher precedence than the foregoing operators, as do the unary increment '++' and decrement '--' operators. These last operators are a shorthand for assigning the value of a variable incremented or decremented by 1 to the same variable. As with other assignment operators, the change to the value of the variable is considered a "side effect", since -- part contents for background part 29 ----- text ----- 34612 -- part contents for background part 27 ----- text ----- pow() function -- part contents for background part 20 ----- text ----- pow() function - p193